oracle.pg.nosql

## Class OraclePropertyGraphUtils

- java.lang.Object
- - oracle.pg.nosql.OraclePropertyGraphUtils

-     public class OraclePropertyGraphUtils
      extends Object

  This class contains utility functions to help manage property graphs stored in the supported backend databases.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OraclePropertyGraphUtils()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `compareFiles(String szSrcFile, String szDstFile)` Compare the two given files to see if they are same
    `static void` | `dropPropertyGraph(oracle.kv.KVStoreConfig kvStoreConfig, String szGraphName)` This method drops an instance of OraclePropertyGraph.
    `static void` | `dropPropertyGraph(oracle.kv.KVStoreConfig kvStoreConfig, String szGraphName, String username, String password)` This method drops an instance of OraclePropertyGraph.
    `static void` | `dropPropertyGraph(OraclePropertyGraph opg)` This method drops an instance of OraclePropertyGraph.
    `static byte[]` | `escape(String s)` This method escapes a string in the following manner: In one scan from left to right, a % is replaced with %25, a tab \t is replaced with %09, a newline \n is replaced with %0A, and a comma is replaced with %2c.
    `static void` | `exportFlatFiles(OraclePropertyGraph pg, OutputStream osVertex, OutputStream osEdge, int dop, boolean append)` This function exports a given property graph into two flat files: one for vertices and the other for edges.
    `static void` | `exportFlatFiles(OraclePropertyGraph pg, String vertexFileName, String edgeFileName, boolean append)` This function exports a given property graph into two flat files: one for vertices and the other for edges.
    `static void` | `exportFlatFiles(OraclePropertyGraph pg, String vertexFileName, String edgeFileName, int dop, boolean append)` This function exports a given property graph into two flat files: one for vertices and the other for edges.
    `static void` | `exportGML(OraclePropertyGraph opg, OutputStream os, PrintStream psOut)` Export the given OraclePropertyGraph instance to be GML format.
    `static void` | `exportGML(OraclePropertyGraph opg, String gmlFileName, PrintStream psOut)` Export the given OraclePropertyGraph instance to be GML format.
    `static void` | `exportGraphML(OraclePropertyGraph opg, OutputStream os, PrintStream psOut)` Export the given OraclePropertyGraph instance to be GraphML format.
    `static void` | `exportGraphML(OraclePropertyGraph opg, String graphMLFileName, PrintStream psOut)` Export the given OraclePropertyGraph instance to be GraphML format.
    `static void` | `exportGraphSON(OraclePropertyGraph opg, OutputStream os, PrintStream psOut)` Export the given OraclePropertyGraph instance to be GraphSON format.
    `static void` | `exportGraphSON(OraclePropertyGraph opg, String graphSonFileName, PrintStream psOut)` Export the given OraclePropertyGraph instance to be GraphSON format.
    `static List<String>` | `getGraphNames(oracle.kv.KVStoreConfig kvsc)` This method gets names of all graphs in database
    `static void` | `importGML(OraclePropertyGraph opg, InputStream is, PrintStream psOut)` Import given graph in GML format to be an OraclePropertyGraph.
    `static void` | `importGML(OraclePropertyGraph opg, String gmlFileName, PrintStream psOut)` Import given graph in GML format to be an OraclePropertyGraph.
    `static void` | `importGraphML(OraclePropertyGraph opg, InputStream is, PrintStream psOut)` Import given graph in GraphML format to be an OraclePropertyGraph.
    `static void` | `importGraphML(OraclePropertyGraph opg, String graphMLFileName, PrintStream psOut)` Import given graph in GraphML format to be an OraclePropertyGraph.
    `static void` | `importGraphSON(OraclePropertyGraph opg, InputStream is, PrintStream psOut)` Import given graph in GraphSON format to be an OraclePropertyGraph.
    `static void` | `importGraphSON(OraclePropertyGraph opg, String graphSonFileName, PrintStream psOut)` Import given graph in GraphSON format to be an OraclePropertyGraph.
    `static <E> List<E>` | `listify(Iterable<E> it)` This method converts a given Iterable instance to a List object.
    `static void` | `quietlyClose(InputStream is)`
    `static void` | `quietlyClose(OutputStream os)`
    `static void` | `quietlyCloseConnections(oracle.kv.KVStoreConfig[] connections)`
    `static void` | `quietlyCloseKVStore(OraclePropertyGraph opg)`
    `static void` | `quietlyShutdown(OraclePropertyGraph opg)`
    `static String[]` | `readFileIntoArray(String filename)`
    `static long` | `size(Iterable it)` This method returns the number of elements in the given Iterable object.
    `static String` | `unescape(String s)` This method escapes a string in the following manner: %2C => ',' %0A => chr(10) %20 => ' ' %09 => chr(9) %25 => '%'
    `static void` | `writeValue(OutputStream os, Object value, byte[] baFieldDelimiter, SimpleDateFormat sdf)` This helper function serializes an object into the given output stream.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OraclePropertyGraphUtils

          public OraclePropertyGraphUtils()

  - ### Method Detail

    - #### compareFiles

          public static boolean compareFiles(String szSrcFile,
                             String szDstFile)
                                      throws IOException

      Compare the two given files to see if they are same
      Throws:
        `IOException`

    - #### dropPropertyGraph

          public static void dropPropertyGraph(oracle.kv.KVStoreConfig kvStoreConfig,
                               String szGraphName)
                                        throws IOException,
                                               Exception

      This method drops an instance of OraclePropertyGraph. All data in this graph will be removed.
      Parameters:
        `kvStoreConfig` - configuration for Oracle NoSQL Database
        `szGraphName` - name of the property graph.
      Throws:
        `IOException`
        `Exception`

    - #### dropPropertyGraph

          public static void dropPropertyGraph(oracle.kv.KVStoreConfig kvStoreConfig,
                               String szGraphName,
                               String username,
                               String password)
                                        throws IOException,
                                               Exception

      This method drops an instance of OraclePropertyGraph. All data in this graph will be removed.
      Parameters:
        `kvStoreConfig` - configuration for Oracle NoSQL Database
        `szGraphName` - name of the property graph.
        `username` - name of the user
        `password` - password of the user
      Throws:
        `IOException`
        `Exception`

    - #### dropPropertyGraph

          public static void dropPropertyGraph(OraclePropertyGraph opg)
                                        throws IOException,
                                               Exception

      This method drops an instance of OraclePropertyGraph. All data in this graph will be removed.
      Parameters:
        `opg` - an instance of OraclePropertyGraph
      Throws:
        `IOException`
        `Exception`

    - #### escape

          public static byte[] escape(String s)

      This method escapes a string in the following manner: In one scan from left to right, a % is replaced with %25, a tab \t is replaced with %09, a newline \n is replaced with %0A, and a comma is replaced with %2c.

    - #### exportFlatFiles

          public static void exportFlatFiles(OraclePropertyGraph pg,
                             OutputStream osVertex,
                             OutputStream osEdge,
                             int dop,
                             boolean append)
                                      throws IOException,
                                             FileNotFoundException,
                                             InterruptedException

      This function exports a given property graph into two flat files: one for vertices and the other for edges.
      Parameters:
        `osVertex` - output stream to store the serialized vertices
        `osEdge` - output stream to store the serialized edges
      Throws:
        `IOException`
        `FileNotFoundException`
        `InterruptedException`

    - #### exportFlatFiles

          public static void exportFlatFiles(OraclePropertyGraph pg,
                             String vertexFileName,
                             String edgeFileName,
                             boolean append)
                                      throws IOException,
                                             FileNotFoundException,
                                             InterruptedException

      This function exports a given property graph into two flat files: one for vertices and the other for edges.
      Throws:
        `IOException`
        `FileNotFoundException`
        `InterruptedException`

    - #### exportFlatFiles

          public static void exportFlatFiles(OraclePropertyGraph pg,
                             String vertexFileName,
                             String edgeFileName,
                             int dop,
                             boolean append)
                                      throws IOException,
                                             FileNotFoundException,
                                             InterruptedException

      This function exports a given property graph into two flat files: one for vertices and the other for edges.
      Throws:
        `IOException`
        `FileNotFoundException`
        `InterruptedException`

    - #### exportGML

          public static void exportGML(OraclePropertyGraph opg,
                       OutputStream os,
                       PrintStream psOut)
                                throws IOException

      Export the given OraclePropertyGraph instance to be GML format.
      Throws:
        `IOException`

    - #### exportGML

          public static void exportGML(OraclePropertyGraph opg,
                       String gmlFileName,
                       PrintStream psOut)
                                throws IOException

      Export the given OraclePropertyGraph instance to be GML format.
      Throws:
        `IOException`

    - #### exportGraphML

          public static void exportGraphML(OraclePropertyGraph opg,
                           OutputStream os,
                           PrintStream psOut)
                                    throws IOException

      Export the given OraclePropertyGraph instance to be GraphML format.
      Throws:
        `IOException`

    - #### exportGraphML

          public static void exportGraphML(OraclePropertyGraph opg,
                           String graphMLFileName,
                           PrintStream psOut)
                                    throws IOException

      Export the given OraclePropertyGraph instance to be GraphML format.
      Throws:
        `IOException`

    - #### exportGraphSON

          public static void exportGraphSON(OraclePropertyGraph opg,
                            OutputStream os,
                            PrintStream psOut)
                                     throws IOException

      Export the given OraclePropertyGraph instance to be GraphSON format.
      Throws:
        `IOException`

    - #### exportGraphSON

          public static void exportGraphSON(OraclePropertyGraph opg,
                            String graphSonFileName,
                            PrintStream psOut)
                                     throws IOException

      Export the given OraclePropertyGraph instance to be GraphSON format.
      Throws:
        `IOException`

    - #### getGraphNames

          public static List<String> getGraphNames(oracle.kv.KVStoreConfig kvsc)
                                            throws OraclePropertyGraphException

      This method gets names of all graphs in database
      Parameters:
        `kvsc` - a `KVStoreConfig` object
      Returns:
        a list of String
      Throws:
        `OraclePropertyGraphException`

    - #### importGML

          public static void importGML(OraclePropertyGraph opg,
                       InputStream is,
                       PrintStream psOut)
                                throws IOException

      Import given graph in GML format to be an OraclePropertyGraph.
      Throws:
        `IOException`

    - #### importGML

          public static void importGML(OraclePropertyGraph opg,
                       String gmlFileName,
                       PrintStream psOut)
                                throws IOException

      Import given graph in GML format to be an OraclePropertyGraph.
      Throws:
        `IOException`

    - #### importGraphML

          public static void importGraphML(OraclePropertyGraph opg,
                           InputStream is,
                           PrintStream psOut)
                                    throws IOException

      Import given graph in GraphML format to be an OraclePropertyGraph.
      Throws:
        `IOException`

    - #### importGraphML

          public static void importGraphML(OraclePropertyGraph opg,
                           String graphMLFileName,
                           PrintStream psOut)
                                    throws IOException

      Import given graph in GraphML format to be an OraclePropertyGraph.
      Throws:
        `IOException`

    - #### importGraphSON

          public static void importGraphSON(OraclePropertyGraph opg,
                            InputStream is,
                            PrintStream psOut)
                                     throws IOException

      Import given graph in GraphSON format to be an OraclePropertyGraph.
      Throws:
        `IOException`

    - #### importGraphSON

          public static void importGraphSON(OraclePropertyGraph opg,
                            String graphSonFileName,
                            PrintStream psOut)
                                     throws IOException

      Import given graph in GraphSON format to be an OraclePropertyGraph.
      Throws:
        `IOException`

    - #### listify

          public static <E> List<E> listify(Iterable<E> it)

      This method converts a given Iterable instance to a List object.
      Parameters:
        `it` - an Iterable instance. It can be NULL.

    - #### quietlyClose

          public static void quietlyClose(InputStream is)

    - #### quietlyClose

          public static void quietlyClose(OutputStream os)

    - #### quietlyCloseConnections

          public static void quietlyCloseConnections(oracle.kv.KVStoreConfig[] connections)

    - #### quietlyCloseKVStore

          public static void quietlyCloseKVStore(OraclePropertyGraph opg)

    - #### quietlyShutdown

          public static void quietlyShutdown(OraclePropertyGraph opg)

    - #### readFileIntoArray

          public static String[] readFileIntoArray(String filename)
                                            throws IOException,
                                                   FileNotFoundException

      Throws:
        `IOException`
        `FileNotFoundException`

    - #### size

          public static long size(Iterable it)

      This method returns the number of elements in the given Iterable object.

    - #### unescape

          public static String unescape(String s)

      This method escapes a string in the following manner: %2C => ',' %0A => chr(10) %20 => ' ' %09 => chr(9) %25 => '%'

    - #### writeValue

          public static void writeValue(OutputStream os,
                        Object value,
                        byte[] baFieldDelimiter,
                        SimpleDateFormat sdf)
                                 throws IOException

      This helper function serializes an object into the given output stream. The accepted object type of value can be String, Float, Integer, Double, Date, Boolean, and Serializable.
      Throws:
        `IOException`

Copyright © 2015 Oracle and/or its afflilates. All Rights Reserved.